home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / wg_lib / kbfrm.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-09-06  |  5.1 KB  |  192 lines

  1. VERSION 2.00
  2. Begin Form kbfrm 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Keyboard Status"
  5.    ClientHeight    =   1965
  6.    ClientLeft      =   1305
  7.    ClientTop       =   2775
  8.    ClientWidth     =   6135
  9.    Height          =   2370
  10.    Left            =   1245
  11.    LinkMode        =   1  'Source
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   1965
  14.    ScaleWidth      =   6135
  15.    Top             =   2430
  16.    Width           =   6255
  17.    Begin CheckBox ClrChk 
  18.       BackColor       =   &H00C0C0C0&
  19.       Caption         =   "Switch ON Color"
  20.       Height          =   210
  21.       Left            =   2070
  22.       TabIndex        =   6
  23.       Top             =   1485
  24.       Width           =   1710
  25.    End
  26.    Begin Timer Timer2 
  27.       Interval        =   10000
  28.       Left            =   330
  29.       Top             =   750
  30.    End
  31.    Begin Timer Timer1 
  32.       Interval        =   100
  33.       Left            =   360
  34.       Top             =   120
  35.    End
  36.    Begin Label led 
  37.       BorderStyle     =   1  'Fixed Single
  38.       Height          =   255
  39.       Index           =   4
  40.       Left            =   4170
  41.       TabIndex        =   5
  42.       Top             =   1080
  43.       Width           =   615
  44.    End
  45.    Begin Label led 
  46.       BorderStyle     =   1  'Fixed Single
  47.       Height          =   255
  48.       Index           =   3
  49.       Left            =   3150
  50.       TabIndex        =   4
  51.       Top             =   1080
  52.       Width           =   615
  53.    End
  54.    Begin Label led 
  55.       BorderStyle     =   1  'Fixed Single
  56.       Height          =   255
  57.       Index           =   2
  58.       Left            =   2265
  59.       TabIndex        =   3
  60.       Top             =   1080
  61.       Width           =   615
  62.    End
  63.    Begin Label led 
  64.       BackColor       =   &H00FFFFFF&
  65.       BorderStyle     =   1  'Fixed Single
  66.       FontBold        =   0   'False
  67.       FontItalic      =   0   'False
  68.       FontName        =   "Small Fonts"
  69.       FontSize        =   6.75
  70.       FontStrikethru  =   0   'False
  71.       FontUnderline   =   0   'False
  72.       Height          =   255
  73.       Index           =   1
  74.       Left            =   1290
  75.       TabIndex        =   2
  76.       Top             =   1080
  77.       Width           =   615
  78.    End
  79.    Begin Label Label 
  80.       BackColor       =   &H00C0C0C0&
  81.       Caption         =   "   CAPS        NUMS     SCROLL     INSERT"
  82.       Height          =   225
  83.       Left            =   1140
  84.       TabIndex        =   1
  85.       Top             =   795
  86.       Width           =   3870
  87.    End
  88.    Begin Label Title 
  89.       BorderStyle     =   1  'Fixed Single
  90.       Caption         =   " As you play with the KB Locks, WGLib functions  on a VB timer will update the pseudo LEDs."
  91.       Height          =   405
  92.       Left            =   960
  93.       TabIndex        =   0
  94.       Top             =   225
  95.       Width           =   4215
  96.    End
  97. DefInt A-Z
  98. Const OnClr = &HFF&
  99. Const OffClr = &H80&
  100. Const OnClr1 = &HFF00&
  101. Const OffClr1 = &H8000&
  102. Sub Form_Load ()
  103.     Call Timer1_timer
  104. End Sub
  105. Sub Form_Paint ()
  106.     ConvexFrm KBFrm, 5
  107.     ConcaveCtl Title, 5
  108.     For x = 1 To 4
  109.         ConcaveCtl Led(x), 4
  110.     Next x
  111. End Sub
  112. Sub Form_Unload (Cancel As Integer)
  113.     MsgBox "This is from VB code using our WGLib functions and is NOT our KBStat Control!", 16, "By the way..."
  114. End Sub
  115. Sub led_Click (Index As Integer)
  116.     Timer2.Enabled = 0
  117.     Select Case Index
  118.         Case 1
  119.             If KeyLockC() Then
  120.                 Call KBCapsOff
  121.             Else
  122.                 Call KBCapsOn
  123.             End If
  124.         Case 2
  125.             If KeyLockN() Then
  126.                 Call KBNumsOff
  127.             Else
  128.                 Call KBNumsOn
  129.             End If
  130.         Case 3
  131.             If KeyLockS() Then
  132.                 Call KBScrlOff
  133.             Else
  134.                 Call KBScrlOn
  135.             End If
  136.         Case 4
  137.             If KeyLockI() Then
  138.                 Call KBInsOff
  139.             Else
  140.                 Call KBInsOn
  141.             End If
  142.     End Select
  143.     Call Timer1_timer
  144. End Sub
  145. Sub Timer1_timer ()
  146.     If ClrChk.value Then
  147.         UseOnClr& = OnClr
  148.         UseOfClr& = OffClr
  149.     Else
  150.         UseOnClr& = OnClr1
  151.         UseOfClr& = OffClr1
  152.     End If
  153.     For x = 1 To 4
  154.        Select Case x
  155.            Case 1
  156.                Stat = KeyLockC()
  157.            Case 2
  158.                Stat = KeyLockN()
  159.            Case 3
  160.                Stat = KeyLockS()
  161.            Case 4
  162.                Stat = KeyLockI()
  163.        End Select
  164.        GoSub SetLed
  165.    Next x
  166.    Exit Sub
  167. SetLed:
  168.     If Stat Then
  169.         Led(x).BackColor = UseOnClr&
  170.     Else
  171.         Led(x).BackColor = UseOfClr&
  172.     End If
  173. Return
  174. End Sub
  175. Sub Timer2_Timer ()
  176.      t& = Led(1).BackColor
  177.      Led(1).BackColor = &HFFFFFF
  178.      Led(1).FontSize = 6.75
  179.      Led(1).Caption = "Click Me"
  180.      Led(1).Refresh
  181.      Beep
  182.      s = Second(Now)
  183.      s = s + 2
  184.      If s > 60 Then s = s - 60
  185.      Do Until (Second(Now) >= s)
  186.          'j = DoEvents()
  187.      Loop
  188.      Led(1).BackColor = t&
  189.      Led(1).Caption = ""
  190.      Led(1).Refresh
  191. End Sub
  192.